﻿/*
   Author: Tomer Paz
   games.com
   2007
*/

// CMD factory - shall return instance of either Remote (Socket) CMD or Local (LocalConnection) CMD

package monopoly.CMD {
	
	import monopoly.CMD.CMD;
	import monopoly.CMD.ICMD;
	import monopoly.CMD.LocalCMD;
	
	public class CMDFactory
		{
		public function CMDFactory():void { }
		
		public function getInstance(ServerName:String, ServerPort:int, myIP:String, secretKey:String):ICMD
			{
			var index:int = ServerName.indexOf("localhost");
			// if found
			if (index != -1) { return (LocalCMD.getInstance(ServerName, ServerPort)); }
			else { return (CMD.getInstance(ServerName, ServerPort, myIP, secretKey)); }
			}
		}
}